<%--
  Created by IntelliJ IDEA.
  User: wyl
  Date: 2022-01-10
  Time: 11:44
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
<div class="container">
    <div class="modal fade" id="savesellchangemy002Modal" >
        <div class="modal-dialog" style="width: 800px;">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal">&times;</button>
                    <h4 class="modal-title">安全库存配置单</h4>
                </div>
                <div class="modal-body">
                    <form id="savesellchangemyform02" class="form form-horizontal">
                        <label>配置单编号:</label>
                        <input type="text" id="savesellchangeid" style="border: none">
                        <label>产品名称:</label>
                        <input type="text" id="savesellchangeproductName" style="border: none">
                        <label>产品编号:</label>
                        <input type="text" id="savesellchangeproductId" style="border: none"><br><br>
                        <label>库存下限数:</label>
                        <input type="text" name="savesellchangeminAmount" id="savesellchangeminAmount"  value="0" style="border-left-style: none;border-right-style: none;border-top-style: none">
                        <label>库存上限数:</label>
                        <input type="text" name="savesellchangemaxAmount" id="savesellchangemaxAmount" value="1000" style="border-left-style: none;border-right-style: none;border-top-style: none"><br><br>
                        <label>设置B/N或S/N:</label>
                        <input style="border: none" value="否" name="" id="1">
                        <label>设计人 :</label>
                        <input style="border: none" value="haha" name="" id="1"><br><br>
                        <div class="row">
                            <table id="savesellchangetablea" border="1px">
                                <tr><td>序号</td><td>库存编号</td><td>仓库名称</td><td>存储地址编号</td><td>存储地址名称</td><td>存储单元简称</td><td>最大存储量</td><td>存储单位</td></tr>

                            </table>
                        </div><br><br>
                        <label>变更人:</label>
                        <input type="text" name="savesellchangeregister"  id="savesellchangeregister" style="border-left-style: none;border-right-style: none;border-top-style: none">
                        <label>变更时间:</label>
                        <input type="text" name="savesellchangeregisterTime" id="savesellchangeregisterTime" style="border: none"><br><br>
                        <label>配置要求:</label>
                        <input type="text" name="savesellchangeconfig" id="savesellchangeconfig"  style="width: 600px;height: 80px;">

                        <%-- <div class="form-group">
                             <label for="productId" class="col-md-2 text-right control-label">产品编号：</label>
                             <div class="clo-md-4">
                                 <input type="text" class="form-control" name="productId" id="productId">
                             </div>
                         </div>--%>
                        <div class="modal-footer">
                            <input type="button" class="btn btn-success" value="提交"   onclick="updatescellwangyinglianger()">
                            <input type="button" class="btn btn-warning" data-dismiss="modal" value="返回">
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>



<div id="savesellchangeselect01">
    <form id="savesellchangemyforma">
        <div class="form-group">
<label>请选择产品I级分类</label><select id="savesellchangeFIRST">
    <option value=" ">---@@@@@---</option>
</select>
<label>请选择产品II级分类</label><select id="savesellchangescoce">
    <option value=" ">---@@@@@---</option>
</select><br><br>
<label>请选择产品III级分类</label><select id="savesellchangethir">
    <option value=" ">---@@@@@---</option>
</select>
<label>请选择产品</label><select id="savesellchangechanping">
    <option value=" ">---@@@@@---</option>
</select>
            <input type="button" value="提交" id="savesellchangechangebutton01">
        </div>
    </form>
</div>
    <input type="hidden" id="savesellchangeid_secellwangyingliang">
<table id="savesellchangechangetable">

</table>
<script>
    var params = {
        url: "${pageContext.request.contextPath}/querySCellbycondwangyingliang.action",
        method: 'GET',                      //请求方式（*）
        toolbar: '#savesellchangerokling_div',              //工具按钮用哪个容器
        striped: true,                      //是否显示行间隔色
        cache: false,                       //是否使用缓存，默认为true，所以一般情况下需要设置一下这个属性（*）
        pagination: true,                   //是否显示分页（*）
        sortable: true,                     //是否启用排序
        sortOrder: "asc",                   //排序方式
        sidePagination: "server",           //分页方式：client客户端分页，server服务端分页（*）
        pageNumber: 1,                      //初始化加载第一页，默认第一页,并记录
        pageSize: 5,                     //每页的记录行数（*）
        pageList: [5, 10, 25, 50, 100],        //可供选择的每页的行数（*）
        search: false,                      //是否显示表格搜索
        strictSearch: true,
        showColumns: true,                  //是否显示所有的列（选择显示的列）
        showRefresh: true,                  //是否显示刷新按钮
        minimumCountColumns: 2,             //最少允许的列数
        clickToSelect: true,                //是否启用点击选中行
        height: 500,                      //行高，如果没有设置height属性，表格自动根据记录条数觉得表格高度
        uniqueId: "id",                     //每一行的唯一标识，一般为主键列
        showToggle: true,                   //是否显示详细视图和列表视图的切换按钮
        cardView: false,                    //是否显示详细视图
        detailView: false,                  //是否显示父子表
        //传递额外的查询用的参数
        queryParams: function (params) {

            //这里的键的名字和控制器的变量名必须一直，这边改动，控制器也需要改成一样的
            var temp = {
                pagesize: params.limit,                         //页面大小
                pageno: (params.offset / params.limit) + 1,   //页码
                checkTag:"S002-1",
                firstKindId:$("#savesellchangeFIRST").val(),
                secondKindId:$("#savesellchangescoce").val(),
                thirdKindId:$("#savesellchangethir").val(),
                productName:$("#savesellchangechanping").val()

            };
            return temp;
        },
        columns: [
            {
                title: "配置单编号",
                field: "id"
            },

            {
                title: "产品编号",
                field: "productId"
            },
            {
                title: "产品名称",
                field: "productName"
            },
            {
                title: "一级分类",
                field: "firstKindName"
            },
            {
                title: "二级分类",
                field: "secondKindName"
            },
            {
                title: "三级分类",
                field: "thirdKindName"
            },

            {
                title: "登记时间",
                field: "registerTime"
            },
            {
                title: "操作",
                field: "",
                formatter: function (value, row, index) {

                    return "<input type='button' onclick='updatescellwangyingliang(" + row.id + ")'  value='更改' data-toggle='modal' data-target='#savesellchangemy002Modal' class='btn btn-warning'>";


                }
            }
        ]
    };

    $("#savesellchangechangetable").bootstrapTable(params);
    $("#savesellchangechangebutton01").click(function () {
        $("#savesellchangechangetable").bootstrapTable("refresh");
    })

    function show001() {
        $.get("${pageContext.request.contextPath}/queryfifstkindname.action",function (data) {
            $("#savesellchangeFIRST>option:gt(0)").remove()
            $(data).each(function (index, item) {
                var option = $("<option value="+item.firstKindId+">" + item.firstKindName + "</option>")
                $("#savesellchangeFIRST").append(option)
            })
        },"json");
    }
    show002()
    function show002() {
        $.get("${pageContext.request.contextPath}/queryfifstkindname.action",function (data) {
            $("#savesellchangescoce>option:gt(0)").remove()
            $(data).each(function (index, item) {
                var option = $("<option value="+item.secondKindId+">" + item.secondKindName + "</option>")
                $("#savesellchangescoce").append(option)
            })
        },"json");
    }
    show003()
    function show003() {
        $.get("${pageContext.request.contextPath}/queryfifstkindname.action",function (data) {
            $("#savesellchangethir>option:gt(0)").remove()
            $(data).each(function (index, item) {
                var option = $("<option value="+item.thirdKindId+">" + item.thirdKindName + "</option>")
                $("#savesellchangethir").append(option)

            })
        },"json");


    }
    show001();
    function show004() {
        $.get("${pageContext.request.contextPath}/queryfifstkindname.action",function (data) {
            $("#savesellchangechanping>option:gt(0)").remove()
            $(data).each(function (index, item) {
                var option = $("<option value="+item.productName+">" + item.productName + "</option>")
                $("#savesellchangechanping").append(option)
            })
        },"json");
    }
    show004();

    function updatescellwangyingliang(id) {
        $.get("${pageContext.request.contextPath}/querySCellbyid.action/"+id,
            function (data) {
                $("#savesellchangeid_secellwangyingliang").val(data.id);
                $("#savesellchangetablea tr:gt(0)").remove();
                $("#savesellchangeid").val(data.id)
                $("#savesellchangeproductName").val(data.productName)
                $("#savesellchangeminAmount").val(data.minAmount)
                $("#savesellchangemaxAmount").val(data.maxAmount)
                $("#savesellchangeproductId").val(data.productId)
                $("#savesellchangeconfig").val(data.config)
                var tr = $("<tr><td id='savesellchangestoreId'>"+"3"+"</td>" +
                    "<td>"+"成品库"+"</td>" +
                    "<td >"+'D001-1'+"</td>" +
                    "<td>"+"成品区"+"</td>" +
                    "<td>"+"DK"+"</td>" +
                    "<td id='savesellchangemaxCapacityAmount'>"+"1000"+"</td>" +
                    "<td id='savesellchangeamount'>"+"100"+"</td>");
                $("#savesellchangetablea").append(tr);
            }),'json'
    }
    function updatescellwangyinglianger(id) {
        alert(111111)
        $.post("${pageContext.request.contextPath}/upSCellcome.action/",
            {id:$("#savesellchangeid_secellwangyingliang").val()},
            function (data) {
                /*   $("#table_01").bootstrapTable(params);*/
                $("#savesellchangechangetable").bootstrapTable("refresh");


            },'json')


    }


</script>

</body>
</html>
